<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class intercommunicator</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../mpi/reference.html#header.boost.mpi.intercommunicator_hpp" title="Header &lt;boost/mpi/intercommunicator.hpp&gt;">
<link rel="prev" href="inplace.html" title="Function inplace">
<link rel="next" href="wait_any.html" title="Function template wait_any">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="inplace.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../mpi/reference.html#header.boost.mpi.intercommunicator_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="wait_any.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.mpi.intercommunicator"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class intercommunicator</span></h2>
<p>boost::mpi::intercommunicator — Communication facilities among processes in different groups. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../mpi/reference.html#header.boost.mpi.intercommunicator_hpp" title="Header &lt;boost/mpi/intercommunicator.hpp&gt;">boost/mpi/intercommunicator.hpp</a>&gt;

</span>
<span class="keyword">class</span> <a class="link" href="intercommunicator.html" title="Class intercommunicator">intercommunicator</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpi</span><span class="special">::</span><span class="identifier">communicator</span> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="intercommunicator.html#boost.mpi.intercommunicatorconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="intercommunicator.html#id-1_3_27_7_15_2_1_1_5-bb"><span class="identifier">intercommunicator</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">MPI_Comm</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">comm_create_kind</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="intercommunicator.html#id-1_3_27_7_15_2_1_1_6-bb"><span class="identifier">intercommunicator</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="communicator.html" title="Class communicator">communicator</a> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="communicator.html" title="Class communicator">communicator</a> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="intercommunicator.html#id-1_3_27_7_15_2_1_1_4-bb">public member functions</a></span>
  <span class="keyword">int</span> <a class="link" href="intercommunicator.html#id-1_3_27_7_15_2_1_1_4_1-bb"><span class="identifier">local_size</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <a class="link" href="group.html" title="Class group">boost::mpi::group</a> <a class="link" href="intercommunicator.html#id-1_3_27_7_15_2_1_1_4_2-bb"><span class="identifier">local_group</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">int</span> <a class="link" href="intercommunicator.html#id-1_3_27_7_15_2_1_1_4_3-bb"><span class="identifier">local_rank</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">int</span> <a class="link" href="intercommunicator.html#id-1_3_27_7_15_2_1_1_4_4-bb"><span class="identifier">remote_size</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <a class="link" href="group.html" title="Class group">boost::mpi::group</a> <a class="link" href="intercommunicator.html#id-1_3_27_7_15_2_1_1_4_5-bb"><span class="identifier">remote_group</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <a class="link" href="communicator.html" title="Class communicator">communicator</a> <a class="link" href="intercommunicator.html#id-1_3_27_7_15_2_1_1_4_6-bb"><span class="identifier">merge</span></a><span class="special">(</span><span class="keyword">bool</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.27.7.16.4.4"></a><h2>Description</h2>
<p>The <code class="computeroutput">intercommunicator</code> class provides communication facilities among processes from different groups. An intercommunicator is always associated with two process groups: one "local" process group, containing the process that initiates an MPI operation (e.g., the sender in a <code class="computeroutput">send</code> operation), and one "remote" process group, containing the process that is the target of the MPI operation.</p>
<p>While intercommunicators have essentially the same point-to-point operations as intracommunicators (the latter communicate only within a single process group), all communication with intercommunicators occurs between the processes in the local group and the processes in the remote group; communication within a group must use a different (intra-)communicator. </p>
<div class="refsect2">
<a name="id-1.3.27.7.16.4.4.4"></a><h3>
<a name="boost.mpi.intercommunicatorconstruct-copy-destruct"></a><code class="computeroutput">intercommunicator</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="id-1_3_27_7_15_2_1_1_5-bb"></a><span class="identifier">intercommunicator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">MPI_Comm</span> <span class="special">&amp;</span> comm<span class="special">,</span> <span class="identifier">comm_create_kind</span> kind<span class="special">)</span><span class="special">;</span></pre>
<p>Build a new Boost.MPI intercommunicator based on the MPI intercommunicator <code class="computeroutput">comm</code>.</p>
<p><code class="computeroutput">comm</code> may be any valid MPI intercommunicator. If <code class="computeroutput">comm</code> is MPI_COMM_NULL, an empty communicator (that cannot be used for communication) is created and the <code class="computeroutput">kind</code> parameter is ignored. Otherwise, the <code class="computeroutput">kind</code> parameter determines how the Boost.MPI communicator will be related to <code class="computeroutput">comm:</code> </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>If <code class="computeroutput">kind</code> is <code class="computeroutput">comm_duplicate</code>, duplicate <code class="computeroutput">comm</code> to create a new communicator. This new communicator will be freed when the Boost.MPI communicator (and all copies of it) is destroyed. This option is only permitted if the underlying MPI implementation supports MPI 2.0; duplication of intercommunicators is not available in MPI 1.x.</p></li>
<li class="listitem"><p>If <code class="computeroutput">kind</code> is <code class="computeroutput">comm_take_ownership</code>, take ownership of <code class="computeroutput">comm</code>. It will be freed automatically when all of the Boost.MPI communicators go out of scope.</p></li>
<li class="listitem"><p>If <code class="computeroutput">kind</code> is <code class="computeroutput">comm_attach</code>, this Boost.MPI communicator will reference the existing MPI communicator <code class="computeroutput">comm</code> but will not free <code class="computeroutput">comm</code> when the Boost.MPI communicator goes out of scope. This option should only be used when the communicator is managed by the user. </p></li>
</ul></div>
<p>
</p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="id-1_3_27_7_15_2_1_1_6-bb"></a><span class="identifier">intercommunicator</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="communicator.html" title="Class communicator">communicator</a> <span class="special">&amp;</span> local<span class="special">,</span> <span class="keyword">int</span> local_leader<span class="special">,</span> 
                  <span class="keyword">const</span> <a class="link" href="communicator.html" title="Class communicator">communicator</a> <span class="special">&amp;</span> peer<span class="special">,</span> <span class="keyword">int</span> remote_leader<span class="special">)</span><span class="special">;</span></pre>
<p>Constructs a new intercommunicator whose local group is <code class="computeroutput">local</code> and whose remote group is <code class="computeroutput">peer</code>. The intercommunicator can then be used to communicate between processes in the two groups. This constructor is equivalent to a call to <code class="computeroutput">MPI_Intercomm_create</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">local</code></span></p></td>
<td><p>The intracommunicator containing all of the processes that will go into the local group.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">local_leader</code></span></p></td>
<td><p>The rank within the <code class="computeroutput">local</code> intracommunicator that will serve as its leader.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">peer</code></span></p></td>
<td><p>The intracommunicator containing all of the processes that will go into the remote group.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">remote_leader</code></span></p></td>
<td><p>The rank within the <code class="computeroutput">peer</code> group that will serve as its leader. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.27.7.16.4.4.5"></a><h3>
<a name="id-1_3_27_7_15_2_1_1_4-bb"></a><code class="computeroutput">intercommunicator</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">int</span> <a name="id-1_3_27_7_15_2_1_1_4_1-bb"></a><span class="identifier">local_size</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the size of the local group, i.e., the number of local processes that are part of the group. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a class="link" href="group.html" title="Class group">boost::mpi::group</a> <a name="id-1_3_27_7_15_2_1_1_4_2-bb"></a><span class="identifier">local_group</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the local group, containing all of the local processes in this intercommunicator. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">int</span> <a name="id-1_3_27_7_15_2_1_1_4_3-bb"></a><span class="identifier">local_rank</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the rank of this process within the local group. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">int</span> <a name="id-1_3_27_7_15_2_1_1_4_4-bb"></a><span class="identifier">remote_size</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the size of the remote group, i.e., the number of processes that are part of the remote group. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a class="link" href="group.html" title="Class group">boost::mpi::group</a> <a name="id-1_3_27_7_15_2_1_1_4_5-bb"></a><span class="identifier">remote_group</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the remote group, containing all of the remote processes in this intercommunicator. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a class="link" href="communicator.html" title="Class communicator">communicator</a> <a name="id-1_3_27_7_15_2_1_1_4_6-bb"></a><span class="identifier">merge</span><span class="special">(</span><span class="keyword">bool</span> high<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Merge the local and remote groups in this intercommunicator into a new intracommunicator containing the union of the processes in both groups. This method is equivalent to <code class="computeroutput">MPI_Intercomm_merge</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">high</code></span></p></td>
<td><p>Whether the processes in this group should have the higher rank numbers than the processes in the other group. Each of the processes within a particular group shall have the same "high" value.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>the new, merged intracommunicator </p></td>
</tr>
</tbody>
</table></div>
</li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2005-2007 Douglas Gregor,
      Matthias Troyer, Trustees of Indiana University<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at &lt;ulink url="http://www.boost.org/LICENSE_1_0.txt"&gt;
        http://www.boost.org/LICENSE_1_0.txt &lt;/ulink&gt;)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="inplace.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../mpi/reference.html#header.boost.mpi.intercommunicator_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="wait_any.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
